package org.sean.framework.ms.config;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;

import java.util.HashMap;
import java.util.Map;

/**
 * 自定义配置加载器
 */
public class CustomerPropertySourceLocator implements EnvironmentPostProcessor {
    @Override
    public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
        Map<String, Object> properties = new HashMap<>();
        properties.put("spring.main.allow-bean-definition-overriding", "true");
        environment.getPropertySources().addLast(new MapPropertySource("customer", properties));
    }
}
